package com.prs.defaultTools;

import java.io.File;
import java.io.IOException;
import java.util.Map;

import javax.swing.Icon;
import javax.swing.filechooser.FileSystemView;


/** 
 * <p>Copyright: Copyright (c) 2012</p>
 * @author JohnLan 
 * E-mail:JohnMr.Lan@foxmail.com 
 * @version ����ʱ�䣺2012-7-11 ����09:48:48 
 * 
 * ��˵�� 
 */

public class PrsToolKit {

	/**
	   * Ϊ���ñ���ϵͳ����ʹ��һЩ���������ļ�����������ַ��������·����������ַ����һ��ת��
	   * @param str:������ַ�һ����˵���ļ������
	   * @return ת������ַ�
	   * @author JohnLan 2012-7-11
	   */
	  public static String getTransformSpecialStr(String str) {
	    String ret = str;
	    if (ret != null && !ret.equals("")) {
	      ret = ret.replace('\\', '\uE7E7');
	      ret = ret.replace('/', '\uE7E8');
	      ret = ret.replace(':', '\uE7E9');
	      ret = ret.replace('*', '\uE7EA');
	      ret = ret.replace('?', '\uE7EB');
	      ret = ret.replace('\"', '\uE7EC');
	      ret = ret.replace('<', '\uE7ED');
	      ret = ret.replace('>', '\uE7EE');
	      ret = ret.replace('|', '\uE7EF');
	    }
	    return ret;
	  }
	  
	  /**
	   * �õ��ĵ���׺��windowsͼ��Ĺ�ϵ
	   * @param format:�ĵ���׺�ַ�
	   * @author JohnLan 2012-07-12
	   * */
	  public static Icon getDocFormatIcon(String format) {
	    // �Ѻ�׺��ͼ���������	 
	        try {
	          File temp = File.createTempFile("Temp", "." + format);
	          Icon icon = FileSystemView.getFileSystemView().getSystemIcon(temp);
	          temp.delete();
	          return icon;
	        }
	        catch (IOException ex) {
	          ex.printStackTrace();
	        }

	       return null;
	   
	  }
}
